<template>
	<view>
		<view class="goods-item">
			<!-- 左侧图片区域 -->
			<view class="goods-item-left">
				<img :src="item.goods_small_logo || defaultPic" class="goods-pic">
			</view>
			<!-- 右侧文字区域 -->
			<view class="goods-item-right">
				<!-- 商品标题 -->
				<view class="goods-name">{{item.goods_name}}</view>
				<!-- 商品信息 -->
				<view class="goods-info-box">
					<!-- 商品价格 -->
					<view class="goods-price">
						￥{{item.goods_price.toFixed(2)}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "my-goods-item",
		props: ["item"],
		data() {
			return {
				defaultPic: 'https://img3.doubanio.com/f/movie/8dd0c794499fe925ae2ae89ee30cd225750457b4/pics/movie/celebrity-default-medium.png'
			};
		}
	}
</script>

<style lang="scss">
	.goods-item {
		display: flex;
		margin: 5px 0;

		.goods-item-left {
			margin-right: 3px;

			.goods-pic {
				display: block;
				width: 100px;
				height: 100px;
			}
		}

		.goods-item-right {
			display: flex;
			flex-direction: column;
			justify-content: space-between;


			.goods-name {
				font-size: 13px;
				/*多行文本溢出隐藏省略号*/
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				/*这里是多少行 就隐藏多少行   当然也要注意文本高度是否足够显示*/
				-webkit-box-orient: vertical;
			}

			.goods-price {
				color: #c00000;
			}
		}
	}
</style>